/*
 * @Author: your name
 * @Date: 2021-08-19 14:20:38
 * @LastEditTime: 2021-08-31 10:51:15
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \webpack-loader-demo\webpack.config.js
 */
const path = require("path");
const commentPlugin = require("./plugins");
module.exports = {
  entry: "./src/index.js",
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "dist"),
  },
  mode: "development",
  module: {
    rules: [
      {
        test: /\.txt$/i,
        use: ["a-loader", "b-loader", "c-loader", "async-loader"],
        //只对项目根目录下 src 目录中的文件采用 babel-loader
        // include: path.resolve(__dirname, "loaders"),
      },
      {
        test: /\.css$/i,
        use: [
          "style-loader",
          "css-loader",
          path.resolve(__dirname, "./loaders/sync/d-loader.js"),
        ],
      },
    ],
  },

  plugins: [new commentPlugin({ name: "deng" })],

  // 为了识别loader , 也可以用上面 path.resolve(__dirname, "./loaders/d-loader.js") 这种方法
  resolveLoader: {
    modules: [
      path.resolve(__dirname, "node_modules"),
      path.resolve(__dirname, "./loaders/async"),
      path.resolve(__dirname, "./loaders/sync"),
    ],
  },
};
